#!/bin/bash -e
#
# Copyright (c) 2019 Dell Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
# LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
#

./cps_api_db_unittest -a
./cps_api_events_unittest -a
./cps_api_operation_unittest -a
./cps_api_key_unittest -a
./cps_class_map_unittest -a
./cps_api_key_cache_unittest -a
./cps_api_registration_unittest -a

if [ $(dpkg-query -W -f='${Status}' python-pytest 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo "Install pytest"
apt-get update
apt-get install -y python-pytest
fi

pytest -s ./test_cps_connectivity_agent.py
